import {PluginCommand} from "../PluginCommand";


class WingProfileDesignCommand extends PluginCommand {
  constructor() {
    super();
  }

  //绘制翼型设计草图
  drawSketch(params){
    if(this.toolQuery && params.pickPntListUp.length != 0 && params.pickPntListDown.length != 0){
      this.toolQuery.createSplineByPoints(params);
    }
  }

  exportTxt(data, name) {
    let urlObject = window.URL || window.webkitURL || window;
    let export_blob = new Blob([data]);
    let save_link = document.createElementNS("http://www.w3.org/1999/xhtml", "a")
    save_link.href = urlObject.createObjectURL(export_blob);
    save_link.download = name;
    save_link.click();
    urlObject.revokeObjectURL(save_link.href);
  };
  getSketchModeMatrix(cb){
    if(this.toolQuery){
      this.toolQuery.getSketchModeMatrix().then(result => {
        cb(result?.data?.matrix?.elements);
      });
    }
  }

  exitSketch(cb) {
    this.command.sketch.exitSketchIncrement().then(res => {
      cb("");
    })
  }
}

const wingProfileDesignCommand = new WingProfileDesignCommand();
export {wingProfileDesignCommand};
